1. Field of Invention
The present invention relates to a clock synchronization system and method in a multi-core processing system.
2. Description of the Prior Art
A problem arises, when tracing programs that run on a multi-core machine having a plurality of processing cores where clocks on each core are not synchronized. This absence of consistent time across the processes complicates program debugging, performance analysis, and visualization. For example, the problem arises in the following situations:
At runtime, at each point, each process has access to a clock, but not all processes have access to the same clock.
Processes may switch to a different clock without being aware of it, though the information about the switch will be available elsewhere in the system. Some cores cannot run background processes. A partial “happened-before” order can be established between events timestamped by different clocks. (e1<e2 in the happened-before order, if we know that event e1 happened before the event e2.)
In the above situations, data generated on different cores comes timestamped with independent timestamps: if event E1 is timestamped with time t1, and event E2, coming from a different core, is timestamped with t2, by comparing t1 and t2, one cannot determine which event occurred first and how much time later the second event occur
The problem of synchronizing clocks has been addressed by Lamport's Virtual Time (“Time, Clocks, and the Ordering of Events in a Distributed Systems”, By L. Lamport, communications of the ACM 21(7), 1978) and Network Time Protocol. In the Lamport's Virtual Time, event ordering is derived from the semantics of events (send must occur before receive). But, the distance (elapsed times) between events are defined arbitrarily in Lamport's algorithm. Therefore, it is not sufficient for performance analysis and visualization. The Network Time protocol is an example prior art algorithm used to synchronize clocks running on different machines as an on-line process. This protocol is based on a server device sending out time signals caught by background processes running on the client nodes. Therefore, it cannot be used with the cores that cannot run background processes.
It would be desirable to provide a system and a method for synchronizing for independent clocks that overcomes addressed drawbacks.